<template>
  <div>
    <el-select
      multiple
      filterable
      remote
      reserve-keyword
      :remote-method="remoteMethod"
      :loading="executorLoading"
      style="display: block"
      placeholder="请选择"
      v-bind="$attrs"
      v-on="$listeners"
      :value="value"
    >
      <el-option
        v-for="item in executorList"
        :key="item.userId"
        :label="item.showName"
        :value="item.userId"
      ></el-option>
    </el-select>
  </div>
</template>
<script>
import { SystemController } from '@/api';
export default {
  props: {
    value: {
      default: ''
    }
  },
  data () {
    return {
      executorLoading: false,
      executorList: []
    }
  },
  created () {
    this.remoteMethod();
  },
  methods: {
    handleChangeSelect (e) {
      console.log(e)
    },
    // 任务执行人搜索
    remoteMethod (query) {
      this.executorLoading = true;
      SystemController.getUserList(this, {
        orderParam: [{ asc: false, fieldName: 'showName' }],
        // pageParam: {
        //   pageNum: 1,
        //   pageSize: 30
        // },
        sysUserDtoFilter: { showName: query }
      })
        .then((res) => {
          this.executorList = res.data.dataList;
          this.executorLoading = false;
        })
        .catch((e) => {
          this.executorLoading = false;
        });
    }
  }
};
</script>
<style lang="scss" scoped>
</style>
